package com.example.map.mvpdemo.bizs;

import android.text.TextUtils;

import com.example.map.mvpdemo.bean.UserBean;

/**
 * Created by qundui on 2017/5/31.
 */

public class UserBiz implements IUserBiz {
    @Override
    public void Login(final String username, final String pwd, final OnLoginListens onLoginListens) {
        Boolean isNUll = checkContentIsNUll(username, pwd);
        if (isNUll){
            new Thread(){
                @Override
                public void run() {
                    super.run();
                    try {
                        Thread.sleep(3000);

                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    if (checkUserInfo(username,pwd)){
                        UserBean userBean=new UserBean();
                        userBean.setPwd(pwd);
                        userBean.setUserName(username);
                        onLoginListens.LoginSucess(userBean);

                    }
                    else{
                        onLoginListens.LoginFail();
                    }
                }
            }.start();

        }
    }
    private Boolean checkContentIsNUll(String username, String pwd) {
        if (!TextUtils.isEmpty(pwd)&&!TextUtils.isEmpty(username)){
            return true;
        }

        return false;
    }
    public boolean checkUserInfo(String ed_userName, String ed_Pwd) {
        if (ed_Pwd.equals("123")&&ed_userName.equals("gsc")){
            return true;
        }
        return false;
    }
}
